package nc.ui.wa.commission.model;

import java.lang.reflect.Array;

import com.ibm.db2.jcc.am.le;

import nc.bs.framework.common.NCLocator;
import nc.hr.frame.persistence.HrBatchService;
import nc.itf.commission.IManageCommissionService;
import nc.ui.hr.pf.model.PFAppModelService;
import nc.vo.pub.BusinessException;
import nc.vo.wa.commission.AggCommissionVO;

public class CommissionModelService extends PFAppModelService{

	private IManageCommissionService manage;

	public IManageCommissionService getService() {
		if (manage == null) {
			manage = NCLocator.getInstance().lookup(IManageCommissionService.class);
		}
		return manage;
	}

	@Override
	public void delete(Object object) throws Exception {
		if(object.getClass().isArray()){
			int length = Array.getLength(object);
			AggCommissionVO[] comArr = new AggCommissionVO[length];
			for(int i = 0;i<length;i++){
				comArr[i] = (AggCommissionVO) Array.get(object, i);
			}
			getService().delete(comArr);
		}
	}
	
	public void batchDelete(Object object) throws Exception {
		getService().delete((AggCommissionVO) object);
	}
	
	

	@Override
	public Object insert(Object object) throws Exception {
		return getService().insert((AggCommissionVO) object);
	}

	@Override
	public Object update(Object object) throws Exception {
		return getService().update((AggCommissionVO) object);
	}

	public AggCommissionVO directApprove(AggCommissionVO aggVO)
			throws BusinessException {
		return getService().directApprove(aggVO);
	}

	public AggCommissionVO updateApproveDate(AggCommissionVO aggVO)
			throws BusinessException {
		return getService().updateApproveDate(aggVO);
	}



}
